/*
 * XML Type:  MemoType
 * Namespace: http://www.data-archive.ac.uk/dext/schema/draft
 * Java type: uk.da.dext.MemoType
 *
 * Automatically generated - do not modify.
 */
package uk.da.dext.impl;

import uk.da.dext.MemoTextType;

/**
 * An XML MemoType(@http://www.data-archive.ac.uk/dext/schema/draft).
 *
 * This is a complex type.
 */
public class MemoTypeImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements uk.da.dext.MemoType
{
    private static final long serialVersionUID = 1L;
    
    public MemoTypeImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName MEMODOCUMENTREF$0 = 
        new javax.xml.namespace.QName("http://www.data-archive.ac.uk/dext/schema/draft", "memoDocumentRef");
    private static final javax.xml.namespace.QName MEMOTEXT$2 = 
        new javax.xml.namespace.QName("http://www.data-archive.ac.uk/dext/schema/draft", "memoText");
    private static final javax.xml.namespace.QName ID$4 = 
        new javax.xml.namespace.QName("", "id");
    private static final javax.xml.namespace.QName CDATE$6 = 
        new javax.xml.namespace.QName("", "cdate");
    private static final javax.xml.namespace.QName MDATE$8 = 
        new javax.xml.namespace.QName("", "mdate");
    private static final javax.xml.namespace.QName CREATOR$10 = 
        new javax.xml.namespace.QName("", "creator");
    private static final javax.xml.namespace.QName LABEL$12 = 
        new javax.xml.namespace.QName("", "label");
    private static final javax.xml.namespace.QName DISPLAYLABEL$14 = 
        new javax.xml.namespace.QName("", "displayLabel");
    private static final javax.xml.namespace.QName LANGUAGE$16 = 
        new javax.xml.namespace.QName("", "language");
    
    
    /**
     * Gets array of all "memoDocumentRef" elements
     */
    public uk.da.dext.MemoDocumentRef[] getMemoDocumentRefArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List<String> targetList = new java.util.ArrayList<String>();
            get_store().find_all_element_users(MEMODOCUMENTREF$0, targetList);
            uk.da.dext.MemoDocumentRef[] result = new uk.da.dext.MemoDocumentRef[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "memoDocumentRef" element
     */
    public uk.da.dext.MemoDocumentRef getMemoDocumentRefArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            uk.da.dext.MemoDocumentRef target = null;
            target = (uk.da.dext.MemoDocumentRef)get_store().find_element_user(MEMODOCUMENTREF$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "memoDocumentRef" element
     */
    public int sizeOfMemoDocumentRefArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(MEMODOCUMENTREF$0);
        }
    }
    
    /**
     * Sets array of all "memoDocumentRef" element
     */
    public void setMemoDocumentRefArray(uk.da.dext.MemoDocumentRef[] memoDocumentRefArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(memoDocumentRefArray, MEMODOCUMENTREF$0);
        }
    }
    
    /**
     * Sets ith "memoDocumentRef" element
     */
    public void setMemoDocumentRefArray(int i, uk.da.dext.MemoDocumentRef memoDocumentRef)
    {
        synchronized (monitor())
        {
            check_orphaned();
            uk.da.dext.MemoDocumentRef target = null;
            target = (uk.da.dext.MemoDocumentRef)get_store().find_element_user(MEMODOCUMENTREF$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(memoDocumentRef);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "memoDocumentRef" element
     */
    public uk.da.dext.MemoDocumentRef insertNewMemoDocumentRef(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            uk.da.dext.MemoDocumentRef target = null;
            target = (uk.da.dext.MemoDocumentRef)get_store().insert_element_user(MEMODOCUMENTREF$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "memoDocumentRef" element
     */
    public uk.da.dext.MemoDocumentRef addNewMemoDocumentRef()
    {
        synchronized (monitor())
        {
            check_orphaned();
            uk.da.dext.MemoDocumentRef target = null;
            target = (uk.da.dext.MemoDocumentRef)get_store().add_element_user(MEMODOCUMENTREF$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "memoDocumentRef" element
     */
    public void removeMemoDocumentRef(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(MEMODOCUMENTREF$0, i);
        }
    }
    
    /**
     * Gets array of all "memoText" elements
     */
    public uk.da.dext.MemoTextType[] getMemoTextArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List<MemoTextType> targetList = new java.util.ArrayList<MemoTextType>();
            get_store().find_all_element_users(MEMOTEXT$2, targetList);
            uk.da.dext.MemoTextType[] result = new uk.da.dext.MemoTextType[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "memoText" element
     */
    public uk.da.dext.MemoTextType getMemoTextArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            uk.da.dext.MemoTextType target = null;
            target = (uk.da.dext.MemoTextType)get_store().find_element_user(MEMOTEXT$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "memoText" element
     */
    public int sizeOfMemoTextArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(MEMOTEXT$2);
        }
    }
    
    /**
     * Sets array of all "memoText" element
     */
    public void setMemoTextArray(uk.da.dext.MemoTextType[] memoTextArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(memoTextArray, MEMOTEXT$2);
        }
    }
    
    /**
     * Sets ith "memoText" element
     */
    public void setMemoTextArray(int i, uk.da.dext.MemoTextType memoText)
    {
        synchronized (monitor())
        {
            check_orphaned();
            uk.da.dext.MemoTextType target = null;
            target = (uk.da.dext.MemoTextType)get_store().find_element_user(MEMOTEXT$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(memoText);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "memoText" element
     */
    public uk.da.dext.MemoTextType insertNewMemoText(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            uk.da.dext.MemoTextType target = null;
            target = (uk.da.dext.MemoTextType)get_store().insert_element_user(MEMOTEXT$2, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "memoText" element
     */
    public uk.da.dext.MemoTextType addNewMemoText()
    {
        synchronized (monitor())
        {
            check_orphaned();
            uk.da.dext.MemoTextType target = null;
            target = (uk.da.dext.MemoTextType)get_store().add_element_user(MEMOTEXT$2);
            return target;
        }
    }
    
    /**
     * Removes the ith "memoText" element
     */
    public void removeMemoText(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(MEMOTEXT$2, i);
        }
    }
    
    /**
     * Gets the "id" attribute
     */
    public java.lang.String getId()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(ID$4);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "id" attribute
     */
    public org.apache.xmlbeans.XmlID xgetId()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlID target = null;
            target = (org.apache.xmlbeans.XmlID)get_store().find_attribute_user(ID$4);
            return target;
        }
    }
    
    /**
     * Sets the "id" attribute
     */
    public void setId(java.lang.String id)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(ID$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(ID$4);
            }
            target.setStringValue(id);
        }
    }
    
    /**
     * Sets (as xml) the "id" attribute
     */
    public void xsetId(org.apache.xmlbeans.XmlID id)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlID target = null;
            target = (org.apache.xmlbeans.XmlID)get_store().find_attribute_user(ID$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlID)get_store().add_attribute_user(ID$4);
            }
            target.set(id);
        }
    }
    
    /**
     * Gets the "cdate" attribute
     */
    public java.util.Calendar getCdate()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(CDATE$6);
            if (target == null)
            {
                return null;
            }
            return target.getCalendarValue();
        }
    }
    
    /**
     * Gets (as xml) the "cdate" attribute
     */
    public org.apache.xmlbeans.XmlDateTime xgetCdate()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlDateTime target = null;
            target = (org.apache.xmlbeans.XmlDateTime)get_store().find_attribute_user(CDATE$6);
            return target;
        }
    }
    
    /**
     * True if has "cdate" attribute
     */
    public boolean isSetCdate()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(CDATE$6) != null;
        }
    }
    
    /**
     * Sets the "cdate" attribute
     */
    public void setCdate(java.util.Calendar cdate)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(CDATE$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(CDATE$6);
            }
            target.setCalendarValue(cdate);
        }
    }
    
    /**
     * Sets (as xml) the "cdate" attribute
     */
    public void xsetCdate(org.apache.xmlbeans.XmlDateTime cdate)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlDateTime target = null;
            target = (org.apache.xmlbeans.XmlDateTime)get_store().find_attribute_user(CDATE$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlDateTime)get_store().add_attribute_user(CDATE$6);
            }
            target.set(cdate);
        }
    }
    
    /**
     * Unsets the "cdate" attribute
     */
    public void unsetCdate()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(CDATE$6);
        }
    }
    
    /**
     * Gets the "mdate" attribute
     */
    public java.util.Calendar getMdate()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(MDATE$8);
            if (target == null)
            {
                return null;
            }
            return target.getCalendarValue();
        }
    }
    
    /**
     * Gets (as xml) the "mdate" attribute
     */
    public org.apache.xmlbeans.XmlDateTime xgetMdate()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlDateTime target = null;
            target = (org.apache.xmlbeans.XmlDateTime)get_store().find_attribute_user(MDATE$8);
            return target;
        }
    }
    
    /**
     * True if has "mdate" attribute
     */
    public boolean isSetMdate()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(MDATE$8) != null;
        }
    }
    
    /**
     * Sets the "mdate" attribute
     */
    public void setMdate(java.util.Calendar mdate)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(MDATE$8);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(MDATE$8);
            }
            target.setCalendarValue(mdate);
        }
    }
    
    /**
     * Sets (as xml) the "mdate" attribute
     */
    public void xsetMdate(org.apache.xmlbeans.XmlDateTime mdate)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlDateTime target = null;
            target = (org.apache.xmlbeans.XmlDateTime)get_store().find_attribute_user(MDATE$8);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlDateTime)get_store().add_attribute_user(MDATE$8);
            }
            target.set(mdate);
        }
    }
    
    /**
     * Unsets the "mdate" attribute
     */
    public void unsetMdate()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(MDATE$8);
        }
    }
    
    /**
     * Gets the "creator" attribute
     */
    public java.lang.String getCreator()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(CREATOR$10);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "creator" attribute
     */
    public org.apache.xmlbeans.XmlString xgetCreator()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(CREATOR$10);
            return target;
        }
    }
    
    /**
     * True if has "creator" attribute
     */
    public boolean isSetCreator()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(CREATOR$10) != null;
        }
    }
    
    /**
     * Sets the "creator" attribute
     */
    public void setCreator(java.lang.String creator)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(CREATOR$10);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(CREATOR$10);
            }
            target.setStringValue(creator);
        }
    }
    
    /**
     * Sets (as xml) the "creator" attribute
     */
    public void xsetCreator(org.apache.xmlbeans.XmlString creator)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(CREATOR$10);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(CREATOR$10);
            }
            target.set(creator);
        }
    }
    
    /**
     * Unsets the "creator" attribute
     */
    public void unsetCreator()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(CREATOR$10);
        }
    }
    
    /**
     * Gets the "label" attribute
     */
    public java.lang.String getLabel()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(LABEL$12);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "label" attribute
     */
    public org.apache.xmlbeans.XmlString xgetLabel()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(LABEL$12);
            return target;
        }
    }
    
    /**
     * True if has "label" attribute
     */
    public boolean isSetLabel()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(LABEL$12) != null;
        }
    }
    
    /**
     * Sets the "label" attribute
     */
    public void setLabel(java.lang.String label)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(LABEL$12);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(LABEL$12);
            }
            target.setStringValue(label);
        }
    }
    
    /**
     * Sets (as xml) the "label" attribute
     */
    public void xsetLabel(org.apache.xmlbeans.XmlString label)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(LABEL$12);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(LABEL$12);
            }
            target.set(label);
        }
    }
    
    /**
     * Unsets the "label" attribute
     */
    public void unsetLabel()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(LABEL$12);
        }
    }
    
    /**
     * Gets the "displayLabel" attribute
     */
    public java.lang.String getDisplayLabel()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(DISPLAYLABEL$14);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "displayLabel" attribute
     */
    public org.apache.xmlbeans.XmlString xgetDisplayLabel()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(DISPLAYLABEL$14);
            return target;
        }
    }
    
    /**
     * True if has "displayLabel" attribute
     */
    public boolean isSetDisplayLabel()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(DISPLAYLABEL$14) != null;
        }
    }
    
    /**
     * Sets the "displayLabel" attribute
     */
    public void setDisplayLabel(java.lang.String displayLabel)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(DISPLAYLABEL$14);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(DISPLAYLABEL$14);
            }
            target.setStringValue(displayLabel);
        }
    }
    
    /**
     * Sets (as xml) the "displayLabel" attribute
     */
    public void xsetDisplayLabel(org.apache.xmlbeans.XmlString displayLabel)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(DISPLAYLABEL$14);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(DISPLAYLABEL$14);
            }
            target.set(displayLabel);
        }
    }
    
    /**
     * Unsets the "displayLabel" attribute
     */
    public void unsetDisplayLabel()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(DISPLAYLABEL$14);
        }
    }
    
    /**
     * Gets the "language" attribute
     */
    public java.lang.String getLanguage()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(LANGUAGE$16);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "language" attribute
     */
    public org.apache.xmlbeans.XmlLanguage xgetLanguage()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlLanguage target = null;
            target = (org.apache.xmlbeans.XmlLanguage)get_store().find_attribute_user(LANGUAGE$16);
            return target;
        }
    }
    
    /**
     * True if has "language" attribute
     */
    public boolean isSetLanguage()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(LANGUAGE$16) != null;
        }
    }
    
    /**
     * Sets the "language" attribute
     */
    public void setLanguage(java.lang.String language)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(LANGUAGE$16);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(LANGUAGE$16);
            }
            target.setStringValue(language);
        }
    }
    
    /**
     * Sets (as xml) the "language" attribute
     */
    public void xsetLanguage(org.apache.xmlbeans.XmlLanguage language)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlLanguage target = null;
            target = (org.apache.xmlbeans.XmlLanguage)get_store().find_attribute_user(LANGUAGE$16);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlLanguage)get_store().add_attribute_user(LANGUAGE$16);
            }
            target.set(language);
        }
    }
    
    /**
     * Unsets the "language" attribute
     */
    public void unsetLanguage()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(LANGUAGE$16);
        }
    }
}
